let temperatures = [73, 74, 75, 71, 69, 72, 76, 73]
var dailyTemperatures = function (temperatures) {
    let len = temperatures.length
    let answer = (new Array(len)).fill(0)
    let struk = []
    for (let i = 0; i < len; i++) {
        while (struk.length && temperatures[i] > temperatures[struk[struk.length - 1]]) {
            let top = struk.pop()
            answer[top] = i - top
        }
        struk.push(i)
    }
    return answer;

};
console.log(dailyTemperatures(temperatures));
